package com.base.taskreports.task.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.base.taskreports.task.dao.slave.TimedTaskDao;
import com.base.taskreports.task.entity.TimeTaskEntity;
import com.base.taskreports.task.service.TaskService;
import com.base.taskreports.task.service.TimedTaskService;

@Service("timedTaskService")
public class TimedTaskServiceImpl extends ServiceImpl<TimedTaskDao, TimeTaskEntity> implements TimedTaskService {

   // @Autowired
   // private SchedulerFactoryBean schedulerFactoryBean;

    @Autowired
    private TaskService taskService;


    /**
     * 根据任务id查询定时任务列表
     * @param id
     * @return
     */
    private List<TimeTaskEntity> selectByTaskId(Integer id) {

        List<TimeTaskEntity> timedTasks = null ;
        // timedTaskMapper.selectByTaskId(id);
        return timedTasks;
    }

/**	public void demo() throws Exception {
		String table =null;
		String flag = "1";
		if("1".equals(flag)) {
			table ="user";
		}else {
			table = "user_01";
		}
		
		AddRequest request = new  AddRequest();
		request.setOneName("张三");
		request.setOneTime("2021-12-01 00:00:00")
		;
		TaskEntity task = new TaskEntity();
		task.setName("李四");
		task.setId(1);
		task.setCreateTime(new Date());
		task.setTableName(table);
		
	
		JobUtils.setJobSchedulerFactory(UserJob.class, schedulerFactoryBean, request, task);
		
		TimeTaskEntity timedTask = new TimeTaskEntity();
		timedTask.setTaskId(1);
        timedTask.setCron(DateUtil.timeToCron("2021-12-01 00:00:00"));
        timedTask.setName("李四");
        timedTask.setJobGroup("remind");
        timedTask.setCreateTime(new Date());
        timedTask.setDeleteFlag(0);
        timedTask.setExecutionTime(DateUtil.timeToDate(DateUtil.getYestoday()));
        this.insert(timedTask);
        
        return null;
	}
*/
}
